/**
 *
 * Copyright by Samuel Castro & Joaquim Fonseca, 2011
 * All Rights Reserved
 *
 * NOTES:
 * Please do not redistribute this plugin without my permission
 * Plugin made for private use only
 *
 */
package com.SySammy.sdQuests.QuestMaker;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener;

public class sdEntityListener extends EntityListener {

    @Override
    public void onEntityDeath(EntityDeathEvent event) {
        if (event instanceof EntityDeathEvent) {
            EntityDeathEvent sub = (EntityDeathEvent) event;
            if ((sub.getEntity() instanceof Player)) {
                Player killed = (Player) sub.getEntity();
                if (killed != null) {
                    QuestMethods.RunningQuests.remove(killed);
                    killed.sendMessage(ChatColor.RED + "Your dead, quest lost. Please try again.");
                }
            }
        }
    }
}
